package rth.entities;

import java.io.Serializable;
import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.proxy.HibernateProxy;

import rth.entities.iface.IReleaseTbl;

import com.felees.hbnpojogen.persistence.IPojoGenEntity;

/**
 * Object mapping for hibernate-handled table: release_tbl.
 * 
 * @author autogenerated
 */

@Entity
@Table(name = "release_tbl", catalog = "rth")
public class ReleaseTbl implements Cloneable, Serializable, IPojoGenEntity,
		IReleaseTbl {

	/** Serial Version UID. */
	private static final long serialVersionUID = -559033206L;

	/**
	 * Use a WeakHashMap so entries will be garbage collected once all entities
	 * referring to a saved hash are garbage collected themselves.
	 */
	private static final Map<Serializable, Long> SAVED_HASHES = Collections
			.synchronizedMap(new WeakHashMap<Serializable, Long>());

	/** hashCode temporary storage. */
	private volatile Long hashCode;

	/** Field mapping. */
	private String archive;
	/** Field mapping. */
	private String basignoff;
	/** Field mapping. */
	private String basignoffby;
	/** Field mapping. */
	private String basignoffcomments;
	/** Field mapping. */
	private String basignoffdate;
	/** Field mapping. */
	private String datecreated;
	/** Field mapping. */
	private String datereceived;
	/** Field mapping. */
	private String description;
	/** Field mapping. */
	private Long id = 0L; // init for hibernate bug workaround
	/** Field mapping. */
	private String logtimestamp;
	/** Field mapping. */
	private String platform;
	/** Field mapping. */
	private Long projectId;
	/** Field mapping. */
	private String qasignoff;
	/** Field mapping. */
	private String qasignoffby;
	/** Field mapping. */
	private String qasignoffcomments;
	/** Field mapping. */
	private String qasignoffdate;
	/** Field mapping. */
	private String releasename;

	/**
	 * Default constructor, mainly for hibernate use.
	 */
	public ReleaseTbl() {
		// Default constructor
	}

	/**
	 * Constructor taking a given ID.
	 * 
	 * @param id
	 *            to set
	 */
	public ReleaseTbl(Long id) {
		this.id = id;
	}

	/**
	 * Constructor taking a given ID.
	 * 
	 * @param archive
	 *            String object;
	 * @param basignoff
	 *            String object;
	 * @param basignoffby
	 *            String object;
	 * @param basignoffdate
	 *            String object;
	 * @param datecreated
	 *            String object;
	 * @param datereceived
	 *            String object;
	 * @param id
	 *            Long object;
	 * @param logtimestamp
	 *            String object;
	 * @param platform
	 *            String object;
	 * @param projectId
	 *            Long object;
	 * @param qasignoff
	 *            String object;
	 * @param qasignoffby
	 *            String object;
	 * @param qasignoffdate
	 *            String object;
	 * @param releasename
	 *            String object;
	 */
	public ReleaseTbl(String archive, String basignoff, String basignoffby,
			String basignoffdate, String datecreated, String datereceived,
			Long id, String logtimestamp, String platform, Long projectId,
			String qasignoff, String qasignoffby, String qasignoffdate,
			String releasename) {

		this.archive = archive;
		this.basignoff = basignoff;
		this.basignoffby = basignoffby;
		this.basignoffdate = basignoffdate;
		this.datecreated = datecreated;
		this.datereceived = datereceived;
		this.id = id;
		this.logtimestamp = logtimestamp;
		this.platform = platform;
		this.projectId = projectId;
		this.qasignoff = qasignoff;
		this.qasignoffby = qasignoffby;
		this.qasignoffdate = qasignoffdate;
		this.releasename = releasename;
	}

	/**
	 * Return the type of this class. Useful for when dealing with proxies.
	 * 
	 * @return Defining class.
	 */
	@Transient
	public Class<?> getClassType() {
		return ReleaseTbl.class;
	}

	/**
	 * Return the value associated with the column: archive.
	 * 
	 * @return A String object (this.archive)
	 */
	@Basic(optional = false)
	@Column(nullable = false, length = 1)
	public String getArchive() {
		return this.archive;

	}

	/**
	 * Set the value related to the column: archive.
	 * 
	 * @param archive
	 *            the archive value you wish to set
	 */
	public void setArchive(final String archive) {
		this.archive = archive;
	}

	/**
	 * Return the value associated with the column: basignoff.
	 * 
	 * @return A String object (this.basignoff)
	 */
	@Basic(optional = false)
	@Column(nullable = false, length = 40)
	public String getBasignoff() {
		return this.basignoff;

	}

	/**
	 * Set the value related to the column: basignoff.
	 * 
	 * @param basignoff
	 *            the basignoff value you wish to set
	 */
	public void setBasignoff(final String basignoff) {
		this.basignoff = basignoff;
	}

	/**
	 * Return the value associated with the column: basignoffby.
	 * 
	 * @return A String object (this.basignoffby)
	 */
	@Basic(optional = false)
	@Column(nullable = false, length = 25)
	public String getBasignoffby() {
		return this.basignoffby;

	}

	/**
	 * Set the value related to the column: basignoffby.
	 * 
	 * @param basignoffby
	 *            the basignoffby value you wish to set
	 */
	public void setBasignoffby(final String basignoffby) {
		this.basignoffby = basignoffby;
	}

	/**
	 * Return the value associated with the column: basignoffcomments.
	 * 
	 * @return A String object (this.basignoffcomments)
	 */
	@Basic(optional = true)
	@Column(length = 21845)
	public String getBasignoffcomments() {
		return this.basignoffcomments;

	}

	/**
	 * Set the value related to the column: basignoffcomments.
	 * 
	 * @param basignoffcomments
	 *            the basignoffcomments value you wish to set
	 */
	public void setBasignoffcomments(final String basignoffcomments) {
		this.basignoffcomments = basignoffcomments;
	}

	/**
	 * Return the value associated with the column: basignoffdate.
	 * 
	 * @return A String object (this.basignoffdate)
	 */
	@Basic(optional = false)
	@Column(nullable = false, length = 19)
	public String getBasignoffdate() {
		return this.basignoffdate;

	}

	/**
	 * Set the value related to the column: basignoffdate.
	 * 
	 * @param basignoffdate
	 *            the basignoffdate value you wish to set
	 */
	public void setBasignoffdate(final String basignoffdate) {
		this.basignoffdate = basignoffdate;
	}

	/**
	 * Return the value associated with the column: datecreated.
	 * 
	 * @return A String object (this.datecreated)
	 */
	@Basic(optional = false)
	@Column(nullable = false, length = 19)
	public String getDatecreated() {
		return this.datecreated;

	}

	/**
	 * Set the value related to the column: datecreated.
	 * 
	 * @param datecreated
	 *            the datecreated value you wish to set
	 */
	public void setDatecreated(final String datecreated) {
		this.datecreated = datecreated;
	}

	/**
	 * Return the value associated with the column: datereceived.
	 * 
	 * @return A String object (this.datereceived)
	 */
	@Basic(optional = false)
	@Column(nullable = false, length = 19)
	public String getDatereceived() {
		return this.datereceived;

	}

	/**
	 * Set the value related to the column: datereceived.
	 * 
	 * @param datereceived
	 *            the datereceived value you wish to set
	 */
	public void setDatereceived(final String datereceived) {
		this.datereceived = datereceived;
	}

	/**
	 * Return the value associated with the column: description.
	 * 
	 * @return A String object (this.description)
	 */
	@Basic(optional = true)
	@Column(length = 21845)
	public String getDescription() {
		return this.description;

	}

	/**
	 * Set the value related to the column: description.
	 * 
	 * @param description
	 *            the description value you wish to set
	 */
	public void setDescription(final String description) {
		this.description = description;
	}

	/**
	 * Return the value associated with the column: id.
	 * 
	 * @return A Long object (this.id)
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Basic(optional = false)
	@Column(name = "releaseid", nullable = false)
	public Long getId() {
		return this.id;

	}

	/**
	 * Set the value related to the column: id.
	 * 
	 * @param id
	 *            the id value you wish to set
	 */
	public void setId(final Long id) {
		// If we've just been persisted and hashCode has been
		// returned then make sure other entities with this
		// ID return the already returned hash code
		if ((this.id == null || this.id == 0L) && (id != null)
				&& (this.hashCode != null)) {
			SAVED_HASHES.put(id, this.hashCode);
		}
		this.id = id;
	}

	/**
	 * Return the value associated with the column: logtimestamp.
	 * 
	 * @return A String object (this.logtimestamp)
	 */
	@Basic(optional = false)
	@Column(nullable = false, length = 19)
	public String getLogtimestamp() {
		return this.logtimestamp;

	}

	/**
	 * Set the value related to the column: logtimestamp.
	 * 
	 * @param logtimestamp
	 *            the logtimestamp value you wish to set
	 */
	public void setLogtimestamp(final String logtimestamp) {
		this.logtimestamp = logtimestamp;
	}

	/**
	 * Return the value associated with the column: platform.
	 * 
	 * @return A String object (this.platform)
	 */
	@Basic(optional = false)
	@Column(nullable = false, length = 6)
	public String getPlatform() {
		return this.platform;

	}

	/**
	 * Set the value related to the column: platform.
	 * 
	 * @param platform
	 *            the platform value you wish to set
	 */
	public void setPlatform(final String platform) {
		this.platform = platform;
	}

	/**
	 * Return the value associated with the column: projectId.
	 * 
	 * @return A Long object (this.projectId)
	 */
	@Basic(optional = false)
	@Column(name = "project_id", nullable = false)
	public Long getProjectId() {
		return this.projectId;

	}

	/**
	 * Set the value related to the column: projectId.
	 * 
	 * @param projectId
	 *            the projectId value you wish to set
	 */
	public void setProjectId(final Long projectId) {
		this.projectId = projectId;
	}

	/**
	 * Return the value associated with the column: qasignoff.
	 * 
	 * @return A String object (this.qasignoff)
	 */
	@Basic(optional = false)
	@Column(nullable = false, length = 40)
	public String getQasignoff() {
		return this.qasignoff;

	}

	/**
	 * Set the value related to the column: qasignoff.
	 * 
	 * @param qasignoff
	 *            the qasignoff value you wish to set
	 */
	public void setQasignoff(final String qasignoff) {
		this.qasignoff = qasignoff;
	}

	/**
	 * Return the value associated with the column: qasignoffby.
	 * 
	 * @return A String object (this.qasignoffby)
	 */
	@Basic(optional = false)
	@Column(nullable = false, length = 25)
	public String getQasignoffby() {
		return this.qasignoffby;

	}

	/**
	 * Set the value related to the column: qasignoffby.
	 * 
	 * @param qasignoffby
	 *            the qasignoffby value you wish to set
	 */
	public void setQasignoffby(final String qasignoffby) {
		this.qasignoffby = qasignoffby;
	}

	/**
	 * Return the value associated with the column: qasignoffcomments.
	 * 
	 * @return A String object (this.qasignoffcomments)
	 */
	@Basic(optional = true)
	@Column(length = 21845)
	public String getQasignoffcomments() {
		return this.qasignoffcomments;

	}

	/**
	 * Set the value related to the column: qasignoffcomments.
	 * 
	 * @param qasignoffcomments
	 *            the qasignoffcomments value you wish to set
	 */
	public void setQasignoffcomments(final String qasignoffcomments) {
		this.qasignoffcomments = qasignoffcomments;
	}

	/**
	 * Return the value associated with the column: qasignoffdate.
	 * 
	 * @return A String object (this.qasignoffdate)
	 */
	@Basic(optional = false)
	@Column(nullable = false, length = 19)
	public String getQasignoffdate() {
		return this.qasignoffdate;

	}

	/**
	 * Set the value related to the column: qasignoffdate.
	 * 
	 * @param qasignoffdate
	 *            the qasignoffdate value you wish to set
	 */
	public void setQasignoffdate(final String qasignoffdate) {
		this.qasignoffdate = qasignoffdate;
	}

	/**
	 * Return the value associated with the column: releasename.
	 * 
	 * @return A String object (this.releasename)
	 */
	@Basic(optional = false)
	@Column(nullable = false, length = 20)
	public String getReleasename() {
		return this.releasename;

	}

	/**
	 * Set the value related to the column: releasename.
	 * 
	 * @param releasename
	 *            the releasename value you wish to set
	 */
	public void setReleasename(final String releasename) {
		this.releasename = releasename;
	}

	/**
	 * Deep copy.
	 * 
	 * @return cloned object
	 * @throws CloneNotSupportedException
	 *             on error
	 */
	@Override
	public ReleaseTbl clone() throws CloneNotSupportedException {

		final ReleaseTbl copy = (ReleaseTbl) super.clone();

		copy.setArchive(this.getArchive());
		copy.setBasignoff(this.getBasignoff());
		copy.setBasignoffby(this.getBasignoffby());
		copy.setBasignoffcomments(this.getBasignoffcomments());
		copy.setBasignoffdate(this.getBasignoffdate());
		copy.setDatecreated(this.getDatecreated());
		copy.setDatereceived(this.getDatereceived());
		copy.setDescription(this.getDescription());
		copy.setId(this.getId());
		copy.setLogtimestamp(this.getLogtimestamp());
		copy.setPlatform(this.getPlatform());
		copy.setProjectId(this.getProjectId());
		copy.setQasignoff(this.getQasignoff());
		copy.setQasignoffby(this.getQasignoffby());
		copy.setQasignoffcomments(this.getQasignoffcomments());
		copy.setQasignoffdate(this.getQasignoffdate());
		copy.setReleasename(this.getReleasename());
		return copy;
	}

	/**
	 * Provides toString implementation.
	 * 
	 * @see java.lang.Object#toString()
	 * @return String representation of this class.
	 */
	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();

		sb.append("archive: " + this.getArchive() + ", ");
		sb.append("basignoff: " + this.getBasignoff() + ", ");
		sb.append("basignoffby: " + this.getBasignoffby() + ", ");
		sb.append("basignoffcomments: " + this.getBasignoffcomments() + ", ");
		sb.append("basignoffdate: " + this.getBasignoffdate() + ", ");
		sb.append("datecreated: " + this.getDatecreated() + ", ");
		sb.append("datereceived: " + this.getDatereceived() + ", ");
		sb.append("description: " + this.getDescription() + ", ");
		sb.append("id: " + this.getId() + ", ");
		sb.append("logtimestamp: " + this.getLogtimestamp() + ", ");
		sb.append("platform: " + this.getPlatform() + ", ");
		sb.append("projectId: " + this.getProjectId() + ", ");
		sb.append("qasignoff: " + this.getQasignoff() + ", ");
		sb.append("qasignoffby: " + this.getQasignoffby() + ", ");
		sb.append("qasignoffcomments: " + this.getQasignoffcomments() + ", ");
		sb.append("qasignoffdate: " + this.getQasignoffdate() + ", ");
		sb.append("releasename: " + this.getReleasename());
		return sb.toString();
	}

	/**
	 * Equals implementation.
	 * 
	 * @see java.lang.Object#equals(java.lang.Object)
	 * @param aThat
	 *            Object to compare with
	 * @return true/false
	 */
	@Override
	public boolean equals(final Object aThat) {
		Object proxyThat = aThat;

		if (this == aThat) {
			return true;
		}

		if (aThat instanceof HibernateProxy) {
			// narrow down the proxy to the class we are dealing with.
			try {
				proxyThat = ((HibernateProxy) aThat)
						.getHibernateLazyInitializer().getImplementation();
			} catch (org.hibernate.ObjectNotFoundException e) {
				return false;
			}
		}
		if (aThat == null) {
			return false;
		}

		final ReleaseTbl that;
		try {
			that = (ReleaseTbl) proxyThat;
			if (!(that.getClassType().equals(this.getClassType()))) {
				return false;
			}
		} catch (org.hibernate.ObjectNotFoundException e) {
			return false;
		} catch (ClassCastException e) {
			return false;
		}

		boolean result = true;
		result = result
				&& (((this.getId() == null) && (that.getId() == null)) || (this
						.getId() != null && this.getId().equals(that.getId())));
		result = result
				&& (((getArchive() == null) && (that.getArchive() == null)) || (getArchive() != null && getArchive()
						.equals(that.getArchive())));
		result = result
				&& (((getBasignoff() == null) && (that.getBasignoff() == null)) || (getBasignoff() != null && getBasignoff()
						.equals(that.getBasignoff())));
		result = result
				&& (((getBasignoffby() == null) && (that.getBasignoffby() == null)) || (getBasignoffby() != null && getBasignoffby()
						.equals(that.getBasignoffby())));
		result = result
				&& (((getBasignoffcomments() == null) && (that
						.getBasignoffcomments() == null)) || (getBasignoffcomments() != null && getBasignoffcomments()
						.equals(that.getBasignoffcomments())));
		result = result
				&& (((getBasignoffdate() == null) && (that.getBasignoffdate() == null)) || (getBasignoffdate() != null && getBasignoffdate()
						.equals(that.getBasignoffdate())));
		result = result
				&& (((getDatecreated() == null) && (that.getDatecreated() == null)) || (getDatecreated() != null && getDatecreated()
						.equals(that.getDatecreated())));
		result = result
				&& (((getDatereceived() == null) && (that.getDatereceived() == null)) || (getDatereceived() != null && getDatereceived()
						.equals(that.getDatereceived())));
		result = result
				&& (((getDescription() == null) && (that.getDescription() == null)) || (getDescription() != null && getDescription()
						.equals(that.getDescription())));
		result = result
				&& (((getLogtimestamp() == null) && (that.getLogtimestamp() == null)) || (getLogtimestamp() != null && getLogtimestamp()
						.equals(that.getLogtimestamp())));
		result = result
				&& (((getPlatform() == null) && (that.getPlatform() == null)) || (getPlatform() != null && getPlatform()
						.equals(that.getPlatform())));
		result = result
				&& (((getProjectId() == null) && (that.getProjectId() == null)) || (getProjectId() != null && getProjectId()
						.equals(that.getProjectId())));
		result = result
				&& (((getQasignoff() == null) && (that.getQasignoff() == null)) || (getQasignoff() != null && getQasignoff()
						.equals(that.getQasignoff())));
		result = result
				&& (((getQasignoffby() == null) && (that.getQasignoffby() == null)) || (getQasignoffby() != null && getQasignoffby()
						.equals(that.getQasignoffby())));
		result = result
				&& (((getQasignoffcomments() == null) && (that
						.getQasignoffcomments() == null)) || (getQasignoffcomments() != null && getQasignoffcomments()
						.equals(that.getQasignoffcomments())));
		result = result
				&& (((getQasignoffdate() == null) && (that.getQasignoffdate() == null)) || (getQasignoffdate() != null && getQasignoffdate()
						.equals(that.getQasignoffdate())));
		result = result
				&& (((getReleasename() == null) && (that.getReleasename() == null)) || (getReleasename() != null && getReleasename()
						.equals(that.getReleasename())));
		return result;
	}

	/**
	 * Calculate the hashcode.
	 * 
	 * @see java.lang.Object#hashCode()
	 * @return a calculated number
	 */
	@Override
	public int hashCode() {
		if (this.hashCode == null) {
			synchronized (this) {
				if (this.hashCode == null) {
					Long newHashCode = null;

					if (getId() != null) {
						newHashCode = SAVED_HASHES.get(getId());
					}

					if (newHashCode == null) {
						if (getId() != null && getId() != 0L) {
							newHashCode = getId();
						} else {
							newHashCode = (long) super.hashCode();

						}
					}

					this.hashCode = newHashCode;
				}
			}
		}
		return (int) (this.hashCode & 0xffffff);
	}

}
